home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / boot / sunprom / RCS / main.c,v < prev    next >
Encoding:
Text File  |  1990-11-27  |  7.3 KB  |  407 lines

  1. head     1.9;
  2. branch   ;
  3. access   ;
  4. symbols  ;
  5. locks    ; strict;
  6. comment  @ * @;
  7.  
  8.  
  9. 1.9
  10. date     90.11.27.11.17.24;  author jhh;  state Exp;
  11. branches ;
  12. next     1.8;
  13.  
  14. 1.8
  15. date     90.11.27.10.37.55;  author rab;  state Exp;
  16. branches ;
  17. next     1.7;
  18.  
  19. 1.7
  20. date     90.07.17.15.41.53;  author mendel;  state Exp;
  21. branches ;
  22. next     1.6;
  23.  
  24. 1.6
  25. date     89.01.06.08.12.02;  author brent;  state Exp;
  26. branches ;
  27. next     1.5;
  28.  
  29. 1.5
  30. date     87.05.11.11.06.57;  author brent;  state Exp;
  31. branches ;
  32. next     1.4;
  33.  
  34. 1.4
  35. date     86.07.24.11.25.46;  author brent;  state Exp;
  36. branches ;
  37. next     1.3;
  38.  
  39. 1.3
  40. date     86.07.23.13.33.11;  author brent;  state Exp;
  41. branches ;
  42. next     1.2;
  43.  
  44. 1.2
  45. date     86.07.21.09.31.17;  author brent;  state Exp;
  46. branches ;
  47. next     1.1;
  48.  
  49. 1.1
  50. date     86.07.16.13.23.46;  author brent;  state Exp;
  51. branches ;
  52. next     ;
  53.  
  54.  
  55. desc
  56. @main boot program
  57. @
  58.  
  59.  
  60. 1.9
  61. log
  62. @got it to compile, moved location for sun3 kernel
  63. @
  64. text
  65. @/* 
  66.  * main.c --
  67.  *
  68.  *    The main program for booting.
  69.  *
  70.  * Copyright 1986 Regents of the University of California
  71.  * All rights reserved.
  72.  */
  73.  
  74. #ifdef  notdef
  75. static char rcsid[] = "$Header: /sprite/src/boot/sunprom/RCS/main.c,v 1.8 90/11/27 10:37:55 rab Exp Locker: jhh $ SPRITE (Berkeley)";
  76. #endif not lint
  77.  
  78.  
  79. #include "sprite.h"
  80. #include "machMon.h"
  81. #include "fsBoot.h"
  82. #include "boot.h"
  83. #undef NO_PRINTF
  84.  
  85. extern Fs_Device fsDevice;        /* Global FS device descriptor */
  86.  
  87. void Exit();
  88.  
  89. /*
  90.  *----------------------------------------------------------------------
  91.  *
  92.  * main --
  93.  *
  94.  *      This gets arguments from the PROM, calls other routines to open
  95.  *      and load the program to boot, and then transfers execution to that
  96.  *      new program.
  97.  *
  98.  * Results:
  99.  *    None.
  100.  *
  101.  * Side effects:
  102.  *    None.
  103.  *
  104.  *----------------------------------------------------------------------
  105.  */
  106.  
  107. main()
  108. {
  109.     ReturnStatus status;
  110.     register MachMonBootParam *paramPtr;/* Ref to boot params supplied
  111.                      * by the PROM montor */
  112.     register int index;            /* Loop index */
  113.     register int entry;            /* Entry point of boot program */
  114.     Fsio_FileIOHandle *handlePtr;    /* Handle for boot program file */
  115.     char *fileName = "vmsprite";
  116.  
  117.     /*
  118.      * The Sun prom collects the boot command line arguments and
  119.      * puts makes them available throught the rom vector.
  120.      */
  121.     paramPtr = *romVectorPtr->bootParam;
  122. #ifdef notdef
  123.     for (index=0 ; index < 8; index ++) {
  124.     if (paramPtr->argPtr[index] != (char *)0) {
  125.         Mach_MonPrintf("Arg %d: %s\n", index, paramPtr->argPtr[index]);
  126.     } else {
  127.         break;
  128.     }
  129.     }
  130.     Mach_MonPrintf("Device %s\n", paramPtr->devName);
  131.     Mach_MonPrintf("File \"%s\"\n", paramPtr->fileName);
  132.  
  133.  
  134. #endif
  135.     /*
  136.      * Set up state about the boot device.
  137.      */
  138.     dev_config(paramPtr, &fsDevice);
  139.     if (paramPtr->fileName[0]) {
  140.     fileName = paramPtr->fileName;
  141.     }
  142.     /*
  143.      * Set up state about the disk.
  144.      */
  145.     status = FsAttachDisk(&fsDevice);
  146. #ifndef SCSI3_BOOT
  147.     if (status != SUCCESS) {
  148.     Mach_MonPrintf("Can't attach disk, status <0x%x>\n",  status);
  149.     goto exit;
  150.     }
  151.     Mach_MonPrintf("Open File \"%s\"\n", fileName);
  152. #endif
  153.     /*
  154.      * Open the file to bootstrap.
  155.      */
  156.     status = Open(fileName, FS_READ, 0, &handlePtr);
  157.     if (status != SUCCESS) {
  158.     Mach_MonPrintf("Can't open \"%s\", <%x>\n", fileName, status);
  159.     goto exit;
  160.     }
  161.     entry = FileLoad(handlePtr);
  162.     if (entry != -1) {
  163.     Mach_MonPrintf("Transferring to location 0x%x\n", entry);
  164.     Boot_Transfer(entry);
  165.     }
  166. exit:
  167.     return;
  168. }
  169.  
  170. /*
  171.  * Exit is called by start.s
  172.  */
  173. void
  174. Exit()
  175. {
  176.     /*
  177.      * Return to start.s and then the PROM monitor.
  178.      */
  179.     return;
  180. }
  181. @
  182.  
  183.  
  184. 1.8
  185. log
  186. @checking this in for rab -- jhh
  187. @
  188. text
  189. @d11 1
  190. a11 1
  191. static char rcsid[] = "$Header: /sprite/src/boot/sunprom/RCS/main.c,v 1.7 90/07/17 15:41:53 mendel Exp Locker: rab $ SPRITE (Berkeley)";
  192. d92 1
  193. a92 1
  194.     status = Fs_Open(fileName, FS_READ, 0, &handlePtr);
  195. @
  196.  
  197.  
  198. 1.7
  199. log
  200. @*** empty log message ***
  201. @
  202. text
  203. @d11 1
  204. a11 1
  205. static char rcsid[] = "$Header: /sprite/src/boot/scsiDiskBoot.new/RCS/main.c,v 1.6 89/01/06 08:12:02 brent Exp Locker: mendel $ SPRITE (Berkeley)";
  206. d74 1
  207. a74 1
  208.     Dev_Config(paramPtr, &fsDevice);
  209. @
  210.  
  211.  
  212. 1.6
  213. log
  214. @Mon_Printf => Mach_MonPrintf
  215. @
  216. text
  217. @d10 2
  218. a11 2
  219. #ifndef lint
  220. static char rcsid[] = "$Header: main.c,v 1.5 87/05/11 11:06:57 brent Exp $ SPRITE (Berkeley)";
  221. d17 3
  222. a19 1
  223. #include "fs.h"
  224. d21 2
  225. d50 2
  226. a51 1
  227.     FsHandle *handlePtr;        /* Handle for boot program file */
  228. d58 1
  229. a58 1
  230. #ifndef NO_PRINTF
  231. a67 1
  232. #endif
  233. a68 5
  234.     /*
  235.      * Set up VM so the user context is the same as the kernel context.
  236.      * This simplifies the mapping routines.
  237.      */
  238.     VmSetUserContext();
  239. d70 1
  240. d72 1
  241. a72 1
  242.      * Probe the boot device.
  243. d74 4
  244. a77 2
  245.     Dev_Config();
  246.  
  247. d79 1
  248. a79 1
  249.      * Set up for Block I/O to the boot device
  250. d81 4
  251. a84 11
  252. #ifndef NO_PRINTF
  253.     Sys_Printf("Boot %s(%d,%d,%d)%s\n", paramPtr->devName,
  254.              paramPtr->ctlrNum, paramPtr->unitNum,
  255.              paramPtr->partNum, paramPtr->fileName);
  256. #endif
  257.     if (paramPtr->devName[0] == 's' &&
  258.     paramPtr->devName[1] == 'd') {
  259.     Fs_AttachDisk(paramPtr->ctlrNum, paramPtr->unitNum,
  260.                      paramPtr->partNum);
  261.     } else {
  262.     Mach_MonPrintf("Can't boot \"%s\"\n", paramPtr->devName);
  263. d87 2
  264. a88 1
  265.  
  266. d92 1
  267. a92 1
  268.     status = Fs_Open(paramPtr->fileName, FS_READ, 0, &handlePtr);
  269. d94 1
  270. a94 1
  271.     Mach_MonPrintf("Can't open \"%s\", <%x>\n", paramPtr->fileName, status);
  272. d99 1
  273. a99 3
  274. #ifndef NO_PRINTF
  275.     Mach_MonPrintf("Transfering to %x\n", entry);
  276. #endif
  277. a111 1
  278.     Mach_MonPrintf("Boot exiting\n");
  279. @
  280.  
  281.  
  282. 1.5
  283. log
  284. @Complete trimmed down version.
  285. @
  286. text
  287. @d11 1
  288. a11 1
  289. static char rcsid[] = "$Header: main.c,v 1.4 86/07/24 11:25:46 brent Exp $ SPRITE (Berkeley)";
  290. d16 1
  291. a16 1
  292. #include "sunMon.h"
  293. a17 1
  294. #include "fsInt.h"
  295. d42 1
  296. a42 1
  297.     register Mon_BootParam *paramPtr;    /* Reference to boot parameters supplied
  298. d56 1
  299. a56 1
  300.         Mon_Printf("Arg %d: %s\n", index, paramPtr->argPtr[index]);
  301. d61 2
  302. a62 2
  303.     Mon_Printf("Device %s\n", paramPtr->devName);
  304.     Mon_Printf("File \"%s\"\n", paramPtr->fileName);
  305. d89 1
  306. a89 1
  307.     Mon_Printf("Can't boot \"%s\"\n", paramPtr->devName);
  308. d98 1
  309. a98 1
  310.     Mon_Printf("Can't open \"%s\", <%x>\n", paramPtr->fileName, status);
  311. d104 1
  312. a104 1
  313.     Mon_Printf("Transfering to %x\n", entry);
  314. d118 1
  315. a118 1
  316.     Mon_Printf("Boot exiting\n");
  317. @
  318.  
  319.  
  320. 1.4
  321. log
  322. @more trimming
  323. @
  324. text
  325. @d11 1
  326. a11 1
  327. static char rcsid[] = "$Header: main.c,v 1.3 86/07/23 13:33:11 brent Exp $ SPRITE (Berkeley)";
  328. d85 2
  329. a86 1
  330.     if (String_Compare("sd", paramPtr->devName) == 0) {
  331. d90 1
  332. a90 1
  333.     Mon_Printf("Can't boot from \"%s\"\n", paramPtr->devName);
  334. @
  335.  
  336.  
  337. 1.3
  338. log
  339. @cosmetic fixes
  340. @
  341. text
  342. @d11 1
  343. a11 1
  344. static char rcsid[] = "$Header: main.c,v 1.2 86/07/21 09:31:17 brent Exp $ SPRITE (Berkeley)";
  345. d89 1
  346. a89 1
  347.     Mon_Printf("Can't boot from dev \"%s\"\n", paramPtr->devName);
  348. d103 1
  349. d105 1
  350. @
  351.  
  352.  
  353. 1.2
  354. log
  355. @First complete versino
  356. @
  357. text
  358. @d11 1
  359. a11 1
  360. static char rcsid[] = "$Header: main.c,v 1.1 86/07/16 13:23:46 brent Exp $ SPRITE (Berkeley)";
  361. d45 3
  362. a47 3
  363.     register int index;
  364.     register int entry;
  365.     FsHandle *handlePtr;
  366. d49 4
  367. d80 5
  368. d87 1
  369. a87 1
  370.                      paramPtr->partNum, &handlePtr);
  371. d103 1
  372. d116 1
  373. a116 1
  374.     Mon_Printf("Exit called\n");
  375. @
  376.  
  377.  
  378. 1.1
  379. log
  380. @Initial revision
  381. @
  382. text
  383. @d11 1
  384. a11 1
  385. static char rcsid[] = "$Header: proto.c,v 1.4 86/03/20 14:00:11 andrew Exp $ SPRITE (Berkeley)";
  386. d17 2
  387. a20 1
  388. void Quit();
  389. d42 1
  390. d46 2
  391. d50 1
  392. d60 1
  393. d62 5
  394. a66 2
  395.     Quit("Quitting to monitor");
  396. }
  397. d68 30
  398. a97 6
  399. void
  400. Quit(msg)
  401.     char *msg;
  402. {
  403.     Mon_Printf("%s\n", msg);
  404.     Exit();
  405. d100 3
  406. @
  407.